package com.xuanyuan.dao.impl;

import java.util.List;

import org.springframework.stereotype.Component;

import com.xuanyuan.dao.SendMessageDao;
import com.xuanyuan.model.Departments;
import com.xuanyuan.util.PageInfo;
@Component("sendMessageDao")
public class SendMessageDaoImpl extends HibernateDaoImpl implements SendMessageDao{

	public List<Departments> getUsers(PageInfo pageInfo) {
		String hql = "from Departments";
		if(pageInfo == null){
			return (List<Departments>)this.find(hql);
		} else {
			return (List<Departments>) this.findPageByQuery(hql, null, pageInfo);
		}
	}

	public List<Departments> getUsersByDepartment(String department, PageInfo pageInfo) {
		String hql = "from Departments s where s.departmentName = '"+department+"'";
		if(pageInfo == null){
			return (List<Departments>)this.find(hql);
		} else {
			return (List<Departments>) this.findPageByQuery(hql, null, pageInfo);
		}
	}

	public List<Departments> getDapartmentsById(Integer departmentsId,
			PageInfo pageInfo) {
		String hql = "from Departments s where s.departmentsId = " + departmentsId;
		if(pageInfo == null){
			return this.find(hql);
		} else {
			return this.findPageByQuery(hql, null, pageInfo);
		}
	}
	
	
      
}
